import React from "react";
//定义类组件
class Class extends React.Component {
    //构造函数
    //   constructor(props) {
    //     super(props);
    //     this.state = {
    //       count: 0
    //     };
    //   }
    state = {
        count: 0
    };
    changeSteate = () =>{
        //测试测试
        this.setState({
            count: this.state.count + 1
        })

    };
    render() {
        return (
            <div>
                <h1>类组件</h1>
                <h2>当前计数：{this.state.count}</h2>
                <button onClick={ this.changeSteate }>
                    点击我
                </button>
            </div>)

    }
}
export default Class;